Scientific Linux 6
Sponsored Link

Enable userdir
2011/03/20
  Enable userdir, users can build websites with this config.

[1] Configure httpd
[root@www ~]#
vi /etc/httpd/conf/httpd.conf


# line 366: make it comment

#
UserDir disable

# line 373: uncomment

UserDir public_html

# line 381-392: uncomment

<Directory /home/*/public_html>
    AllowOverride
All
# change

    Options
ExecCGI
# enable CGI

    <Limit GET POST OPTIONS>
         Order allow,deny
         Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
         Order deny,allow
         Deny from all
    </LimitExcept>
</Directory>

[root@www ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[ OK ]

Starting httpd:
[ OK ]
[2] Create a CGI test page in a user's home directory and access to it with web browser. It's OK if following page is shown.
[fermi@www ~]$
mkdir public_html

[fermi@www ~]$
chmod 711 /home/fermi

[fermi@www ~]$
chmod 755 /home/fermi/public_html

[fermi@www ~]$
cd public_html

[fermi@www public_html]$
vi index.cgi


#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
print <<"EOM";
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page ( /home/fermi/public_html )
</div>
</body>
</html>
EOM
exit;


[fermi@www public_html]$
chmod 705 index.cgi
 
Tweet